The FILEIO Sample

The FILEIO Sample accompanies Chapter 3 and illustrates how to perform file I/O operations in Windows 2000 and Windows 98.

The sample includes two components:

Building FILEIO

To build FILEIO.SYS, you need to have both the Windows 2000 DDK and the Windows 98 DDK installed. Follow the general instructions for building a WDM sample. The Microsoft Visual C++ project file is named FILEIO.DSP. Unfortunately, you cannot use the BUILD utility for this sample program because BUILD is unable to cope with modules that have different compile options than other modules in the project.

To build TEST.EXE, follow the general instructions for building user-mode samples

Testing FILEIO

Install the FILEIO.SYS driver. Follow the general instructions for using FastInst in Windows 2000 or the Add New Hardware wizard in Windows 98. The INF file is named SYS\DEVICE.INF. Windows 98 may prompt your for the location of FILEIO.JNK, which is in the project directory itself.

During initialization, the driver will read the contents of the file FILEIO.JNK from the Drivers directory. Thereafter, open a command prompt and execute the TEST.EXE program in the TEST\DEBUG subdirectory. TEST will report the file data read by the driver.

This sample illustrates how you can do file I/O operations in a driver without needing separate binaries for Windows 2000 and Windows 98. Microsoft prefers that you ship separate binaries, however. If you elect to do that, you would (obviously) need to remove the runtime test for the platform you're using and conditionally compile one or the other version of the file I/O functions.